<html> <!--folder/*{{{*/-->
<head>
<title>DIGI-Infomat</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<link href="style.css" rel="stylesheet" type="text/css">
	<style type="text/css">
		.style1
		{ width: 20%;}
	</style>

<script type="text/javascript">
function beforeSave()
{
	if (html_blank == "val_blank") {
		if(movie_blank = "val_blank") {
			alert("Both Html and Movie cannot be Blank");
			return false;
		}
	}	
}
</script>
</head>
<!--folder /*}}}*/-->
<?php
/***************************** PHP **********************************/
include  "xplaylist.php";
$xlist = new XPlayList();
if (!empty($_GET)) {
	if (isset($_GET["id"])) {
		$currentIndex = $_GET["id"];
		if (is_numeric($currentIndex)) {
		} else {
			$currentIndex = -1; //indicate insert 
		}
		$xlist->setMode($currentIndex);;
	}
} else {
   if (!empty($_POST)) {	
	   //echo "<pre>";  /*{{{*/
	   //print_r($_POST);
	   //echo "</pre>";  /*}}}*/
	
	   if (isset($_POST['html_radio']))
	   {
		   if ($_POST['html_radio'] == "val_blank") 
		   {
			   $in_html = "";
		   } else {
			   $in_html = $_POST['html_radio'];
		   }
	   }
	   if (isset($_POST['movie_radio']))
	   {
		   if ($_POST['movie_radio'] == "val_blank") 
		   {
			   $in_movie = "";
		   } else {
			   $in_movie = $_POST['movie_radio'];
		   }
	   } 
	   $xlist->saveRoutineList($in_html,$in_movie);
   } //end-of-POST
}
/* **************************** PHP **********************************/
?>
<!--folder /*{{{*/-->
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" style="text-align:center">
<table width="100%"> 
<tr>
   <td align="center">
		<table width="780px" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td>
					<table border="0" bgcolor="#FFFFFF" width="100%">
						<tr>
							<td rowspan="2" width="20%"><img src="images/logo.png" alt="logo"></td>
						</tr>

						<tr valign="bottom"  align="center">
							<td><a href="home.php"><img style="border-width:0px;" src="images/btn_home.png"  alt="HOME"></a></td>
							<td><a href="network.php"><img style="border-width:0px;" src="images/btn_network.png" alt="Network Setting"></a></td>
							<td><a href="update.php"><img style="border-width:0px;" src="images/btn_update.png" alt="Update"></a></td>
							<td><a href="setting.php"><img style="border-width:0px;" src="images/btn_setting.png" alt="setting"></a></td>
							<td><a href="filemanage.php"><img style="border-width:0px;" src="images/btn_filemanage.png" alt="File Manage"></a></td>
							<td><a href="routinelist.php"><img style="border-width:0px;" src="images/btn_playlist.png" alt="File Manage"></a></td>
						</tr>
					</table>
				</td>
			</tr> 
			<tr>
				<td colspan="2">
					<table border="0" cellspacing="0" cellpadding="0"></table>
				</td>
			</tr>
			<tr>
				<td colspan="2" valign="middle" bgcolor="#FFFFFF">
<!--folder /*}}}*/-->
				 <form name="form_routinelist" method="post" enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>">   <!-- Todo: remove it -->
				  <table border="0" cellspacing="0" cellpadding="0"  width="780px">
					<tr>
						<td valign="middle" style="width:3%;">&nbsp;</td>  <!--padding-->
						<td valign="top" align="left" style="width:380px"> <!--HtmlList-->
<?php
$xlist->showHtmlListTableForEditList($currentIndex);
echo "<br>";
?>
					   </td>
					   <td valign="top" align="left" style="width:380px"> <!--MovieList-->
<?php
$xlist->showMovieListTableForEditList($currentIndex);
?>
					<br>
					   </td>
					   </tr> 
					<tr> 
					<td></td>
					<td><input type="submit" value="Save" onclick="return beforeSave()"></input>
					<input type="button" value="Cancel"  ONCLICK="window.location.href='routinelist.php'"></input></td>
				<!--	<td><input type="submit" value="Reset"></input></td> -->
					</tr>
					</table>
                </form>
				</td>
			</tr>
		<tr>  <!--/*{{{*/ footer-->
		<td colspan="2" align="center" class="white-text">
			<table width="100%" border="0" cellspacing="0" cellpadding="10">
			<tr>
			<td align="center" class="white-text">Copyright &copy;  Teraoka Weigh System. All Rights Reserved.</td>
			</tr>
			</table>
		</td>
		</tr>
	</table>
   </td>
</tr>
</table>
</body>
</html> <!--/*}}}*/-->
